package com.mlog.njyjy.ndop.msg.common.domain;

import com.jfinal.plugin.activerecord.Model;
import com.mlog.njyjy.ndop.msg.common.domain.core.Timeable;
import com.mlog.njyjy.ndop.msg.common.support.Constants;
import com.mlog.njyjy.ndop.share.sql.annotation.Column;
import com.mlog.njyjy.ndop.share.sql.annotation.Id;
import com.mlog.njyjy.ndop.share.sql.annotation.Join;
import com.mlog.njyjy.ndop.share.sql.annotation.Table;
import com.mlog.njyjy.ndop.share.sql.support.JoinFetchType;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;
import java.util.List;


/**
 * <p>
 * 字典表
 * </p>
 *
 * @author <a href="mailto:yingxiufeng@mlogcn.com">alex</a>
 * @version v1.0, 2020/7/10
 */
@Data
@Accessors(chain = true)
@Table(prefix = Constants.TBL_MSG_PREFIX, comment = "字典表")
public class Dict extends Model<Dict> implements Timeable {

    @Id
    private Long id;

    @Column(nullable = false, unique = true, comment = "字典名")
    private String name;

    /**
     * 别名
     */
    private String alias;

    /**
     * 创建时间
     */
    private LocalDateTime createAt;

    /**
     * 更新时间
     */
    private LocalDateTime updateAt;

    /**
     * TESTME
     */
    @Join(joinedBy = "id", mappedBy = "dictId")
    private List<DictItem> items;


    public List<DictItem> getItems() {
        return items;
    }
}
